<%-- 
    Document   : index
    Created on : Jul 18, 2013, 11:25:27 PM
    Author     : Ndnam
--%>

<%@page import="classes.Bid"%>
<%@page import="classes.ProductType"%>
<%@page import="classes.User"%>
<%@page import="classes.Auction"%>
<%@page import="classes.Shipment"%>
<%@page import="java.util.ArrayList"%>
<%@page import="classes.AuctionDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%  AuctionDAO auctionDAO = new AuctionDAO();
            ArrayList<Auction> listAuction = auctionDAO.getAuctionTable();
            ArrayList<User> listUser = auctionDAO.getUserTable();
            ArrayList<ProductType> listProductType = auctionDAO.getProductTypeTable();
            ArrayList<Bid> listBid = auctionDAO.getBidTable();
        %>
        Auction Table:
        <table border='1'>
            <% for (Auction item : listAuction) {
                    out.println("<tr>"
                            + "<td>" + item.getAuctionID() + "</td>"
                            + "<td>" + item.getCreator() + "</td>"
                            + "<td>" + item.getLastbidder() + "</td>"
                            + "<td>" + item.getProductType() + "</td>"
                            + "<td>" + item.getProductName() + "</td>"
                            + "<td>" + item.getInitialPrice() + "</td>"
                            + "<td>" + item.getLastPrice() + "</td>"
                            + "<td>" + item.getBeginTime() + "</td>"
                            + "<td>" + item.getBeginDate() + "</td>"
                            + "<td>" + item.getEndTime() + "</td>"
                            + "<td>" + item.getEndDate() + "</td>"
                            + "<td>" + item.getState() + "</td>"
                            + "<td>" + item.getPaymentTypes() + "</td>"
                            + "<td>" + item.getShipmentTypes() + "</td>"
                            + "<td>" + item.getImageURL()+ "</td>"
                            + "<td>" + item.getVideoURL()+ "</td>"
                            + "</tr>");
                }
            %>
        </table><br>
        User Table:
        <table border='1'>
            <% for (User item : listUser) {
                    out.println("<tr>"
                            + "<td>" + item.getUserID() + "</td>"
                            + "<td>" + item.getUsername() + "</td>"
                            + "<td>" + item.getFirstname() + "</td>"
                            + "<td>" + item.getLastname() + "</td>"
                            + "<td>" + item.getEmail() + "</td>"
                            + "<td>" + item.getPassword() + "</td>"
                            + "<td>" + item.getUsertype() + "</td>"
                            + "<td>" + item.getAddress1() + "</td>"
                            + "<td>" + item.getAddress2() + "</td>"
                            + "<td>" + item.getState() + "</td>"
                            + "<td>" + item.getZipcode() + "</td>"
                            + "<td>" + item.getCountry() + "</td>"
                            + "<td>" + item.getPhonenumber() + "</td>"
                            + "</tr>");
                }
            %>
        </table><br>
        ProductType Table:
    <table border='1'>
        <% for (ProductType item : listProductType) {
                out.println("<tr>"
                        + "<td>" + item.getTypeID()+ "</td>"
                        + "<td>" + item.getType()+ "</td>"
                        + "</tr>");
            }
        %>
    </table><br>
    Bid Table:
    <table border='1'>
        <% for (Bid item : listBid) {
                out.println("<tr>"
                        + "<td>" + item.getBidID()+ "</td>"
                        + "<td>" + item.getAuctionID()+ "</td>"
                        + "<td>" + item.getBidderID()+ "</td>"
                        + "<td>" + item.getPlacedPrice()+ "</td>"
                        + "<td>" + item.getState()+ "</td>"
                        + "<td>" + item.getBidTime()+ "</td>"
                        + "</tr>");
            }
        %>
    </table><br>

    <%= auctionDAO.searchUserByUsername("abcxzy") %> <br>
    <%= auctionDAO.searchUserByEmail("ndnam95@gmail.com") %> 
</body>
</html>
